package com.xxmw.transaction.controller.brick;

import com.xxmw.transaction.common.entity.P;
import com.xxmw.transaction.common.entity.R;
import com.xxmw.transaction.controller.BaseController;
import com.xxmw.transaction.model.brick.BrickOrder;
import com.xxmw.transaction.service.app.BrickOrderService;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 交易所订单管理
 * @author luowenliang
 * @since 2020/2/17 15:49
 */
@RestController
@RequestMapping("/admin/brick/order")
public class BrickOrderController extends BaseController {

    @Autowired
    private BrickOrderService bourseOrderService;

    /**
     * 列表获取
     * @param pageNum
     * @param pageSize
     * @param bourse
     * @return
     */
    @GetMapping("/list")
    @RequiresPermissions("brick:order:list")
    public R list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                  @RequestParam(value = "pageSize", defaultValue = "20")Integer pageSize,
                  @RequestParam(value = "bourse", required = false) Integer bourse,
                  @RequestParam(value = "id", required = false) Long id,
                  @RequestParam(value = "status", required = false) Integer status,
                  @RequestParam(value = "outId", required = false) String outId,
                  @RequestParam(value = "username", required = false) String username) {
        P<BrickOrder> p = bourseOrderService.pageList(pageNum, pageSize, id, bourse, status, outId, username, null);
        return R.ok(p);
    }

}
